// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the HOOK_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// HOOK_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef HOOK_EXPORTS
#define HOOK_API __declspec(dllexport)
#else
#define HOOK_API __declspec(dllimport)
#endif


#define BUF_IO_SIZE (16*BUFSIZ)
#define APP_COUNT 128
#define UWM_MOUSE_HOOK_MSG (_T("UWM_MOUSE_HOOK_MSG{ABCD-WXYZ}"))
#define UWM_KEYBOARD_HOOK_MSG (_T("UWM_KEYBOARD_HOOK_MSG{ABCD-WXYZ}"))

typedef struct
{
	BOOL isHookMouse;
	BOOL isHookKeyboard;

	BOOL isTrackMouseMove;
	BOOL isLogMouseMove;
	BOOL isNotifyServer;

	TCHAR logFile[MAX_PATH];
	TCHAR logFormat[64];
	//BOOL isLogText;
	BOOL isKeyUpOnly;
} HookConf, *PHookConf;

typedef struct
{
	time_t			time;
	unsigned char	type:1;	// 0 for Mouse, 1 for Keyboard
	unsigned char	app:7;	// app code, support 128 app currently.
	unsigned char	value;	// button for Mouse, virtual key code for Keyboard
	unsigned char	param;	// reserved for Mouse, flags for Keyboard (high 8 bits of lParam)
} Record;

typedef struct
{
	int signature;	// must be 0xAAAAAAAA
	int version;
	int encoding;	// 1: ANSI; 2: UNICODE
	TCHAR info[128];
} LogHeader;

extern HWND s_hWndServer;
extern HookConf s_sHookConf;

extern UINT g_MOUSE_UWM_HOOK;
extern UINT g_KEYBOARD_UWM_HOOK;
extern HINSTANCE g_hIns;

extern TCHAR s_tFiles[APP_COUNT][MAX_PATH];

HOOK_API BOOL InstallHook(HWND hWnd);
HOOK_API BOOL UninstallHook();
HOOK_API void SetConf(PHookConf pConf);